import request from '../utils/request'

export default {
    listSubDept(parentId) {
        return request.get('/sysDept/listSubDept', { parentId })
    },
    listDept(keyword) {
        return request.get('/sysDept/listDept', { keyword })
    },
    get(id) {
        return request.get('/sysDept/get', { id })
    },
    findManagerPageData({ current, size, query }) {
        return request.get('/sysDept/managerPageData',
            {
                current,
                size,
                ...query
            })
    },
    findMemberPageData({ current, size, query }) {
        return request.get('/sysDept/userPageData',
            {
                current,
                size,
                ...query
            })
    },
    findSubPage({ current, size, query }) {
        return request.get('/sysDept/pageSubData',
            {
                current,
                size,
                ...query
            })
    },
    findPage({ current, size, query }) {
        return request.get('/sysDept/pageData',
            {
                current,
                size,
                ...query
            })
    },
    add(data) {
        return request.post('/sysDept/save', data)
    },
    update(data) {
        return request.post('/sysDept/update', data)
    },
    delete(id) {
        return request.get('/sysDept/delete', { id })
    },
    deleteBatch(data) {
        return request.post('/sysDept/deleteBatch', data)
    },
    addManagerBatch(deptId, managerIdList) {
        return request.post(`/sysDept/addManagerBatch?deptId=${deptId}`, managerIdList)
    },
    delManagerBatch(deptId, managerIdList) {
        return request.post(`/sysDept/delManagerBatch?deptId=${deptId}`, managerIdList)
    },
    addMemberBatch(deptId, memberIdList) {
        return request.post(`/sysDept/addMemberBatch?deptId=${deptId}`, memberIdList)
    },
    delMemberBatch(deptId, memberIdList) {
        return request.post(`/sysDept/delMemberBatch?deptId=${deptId}`, memberIdList)
    },
}